<?php
include '../newlib.php';
include '../lib/AppScope.pre.php';

$theUser = $app->theUser;

$id = $_REQUEST['id'];
$new =$_REQUEST['new'];
include 'header.php';


$stm = $tmpConnection->prepare("select * from vwcontent where schemaid=:id");
$stm->execute(array(':id' => $id));
$rs = $stm->fetch(PDO::FETCH_ASSOC);
$van = $rs['van'] ? asFormattedDate($rs['van']) : "";
$tot = $rs['tot'] ? asFormattedDate($rs['tot']) : "";
$titel = $rs['titel'];
$checkedMa = $rs['ma'] ? "checked " : "";
$checkedDi = $rs['di'] ? "checked " : "";
$checkedWo = $rs['wo'] ? "checked " : "";
$checkedDo = $rs['do'] ? "checked " : "";
$checkedVr = $rs['vr'] ? "checked " : "";
$checkedZa = $rs['za'] ? "checked " : "";
$checkedZo = $rs['zo'] ? "checked " : "";

echo <<<EOD
<h2>$titel</h2>
<strong>Uitzendschema</strong><hr>
	<script language="JavaScript" src="../script/calendar.js"></script>
	
	<table><form action="schemasave.php?id=$id&new=$new" method="post" name="editForm" id="frmSchema">
		<tr><td>Vanaf d.d.</td><td><input onClick="setDateField(document.editForm.van); top.newWin = window.open('../calendar.html', 'cal', 'dependent=yes, width=210, height=230, top=180, left=400, screenX=200, screenY=300, titlebar=yes'); top.newWin.focus();" name="van" readonly type="Text" size="10" value="$van">
								<A HREF="javascript:doNothing()" onClick="setDateField(document.editForm.van); top.newWin = window.open('../calendar.html', 'cal', 'dependent=yes, width=210, height=230, top=180, left=400, screenX=200, screenY=300, titlebar=yes'); top.newWin.focus();"><IMG SRC="../sysimages/calendar.gif" BORDER=0><font color="#000000">kies datum</font></A>&nbsp;|&nbsp;
								<A HREF="javascript:doNothing()" onClick="document.editForm.van.value = '';"><IMG SRC="../sysimages/calendar.gif" BORDER=0><font color="#000000">geen datum</font></A></td></tr>

		<tr><td>Tot en met d.d.</td><td><input onClick="setDateField(document.editForm.tot); top.newWin = window.open('../calendar.html', 'cal', 'dependent=yes, width=210, height=230, top=180, left=400, screenX=200, screenY=300, titlebar=yes'); top.newWin.focus();" name="tot" readonly type="Text" size="10" value="$tot">
								<A HREF="javascript:doNothing()" onClick="setDateField(document.editForm.tot); top.newWin = window.open('../calendar.html', 'cal', 'dependent=yes, width=210, height=230, top=180, left=400, screenX=200, screenY=300, titlebar=yes'); top.newWin.focus();"><IMG SRC="../sysimages/calendar.gif" BORDER=0><font color="#000000">kies datum</font></A>&nbsp;|&nbsp;
								<A HREF="javascript:doNothing()" onClick="document.editForm.tot.value = '';"><IMG SRC="../sysimages/calendar.gif" BORDER=0><font color="#000000">geen datum</font></A></td></tr>

		<tr><td colspan="2"><input type="checkbox" name="ma" $checkedMa> maandag</td></tr>
		<tr><td colspan="2"><input type="checkbox" name="di" $checkedDi> dinsdag</td></tr>
		<tr><td colspan="2"><input type="checkbox" name="wo" $checkedWo> woensdag</td></tr>
		<tr><td colspan="2"><input type="checkbox" name="do" $checkedDo> donderdag</td></tr>
		<tr><td colspan="2"><input type="checkbox" name="vr" $checkedVr> vrijdag</td></tr>
		<tr><td colspan="2"><input type="checkbox" name="za" $checkedZa> zaterdag</td></tr>
		<tr><td colspan="2"><input type="checkbox" name="zo" $checkedZo> zondag</td></tr>
		
		<tr><td colspan="2" align="right"><input type="submit" value="Bewaar"> <input type="button" onclick="window.close();" value="Annuleer"></td></tr>
	</form></table>

EOD;
include 'footer.php';
?>